/******************************************************************************/
/*  Class DEVICE                                                              */
/*  PO: S. Maslyakov, rusoil.9@gmail.com                                      */
/*                                                                            */
/*  Revision:     1.5                                                         */
/*  Date:         2010/12/20 14:40:33                                         */
/******************************************************************************/


#ifndef __DEVICE_H
#define __DEVICE_H


#include "data_types.h"
#include "Device\device_def.h"



//==============================================================================
//  Class DEVICE
//==============================================================================
class DEVICE
{

public:
  static void Init_Device();
  static void Init_device_task();
  static void * Get_device_sett_dque();
  static void * Get_mem_pool_20();
  static void * Get_mem_pool_36();
  static void * Get_mem_pool_64();
  static void * Get_mem_pool_128();
  static void * Get_mem_pool_300();
  static void * Get_mem_pool_600();
  static void * Get_mem_pool(const uint32_t _size);
  static uint32_t Get_mem_pool_size(const uint32_t _size);
  static uint32_t WriteSett(const void * const _pData);
  static uint32_t ReadSett(void * const _pData);

  inline static void TimerTickRoutine() { m_timers.timer_5ms++; }
  inline static uint8_t GetMbAddr() { return m_devSett.mbAddr; }
  inline static uint32_t GetDevId() { return m_devSett.id; }
  inline static uint32_t GetPackTimer() { return m_devSett.packTimer; }
  inline static uint32_t GetRfileTimer() { return m_devSett.rfileTimer; }
  inline static uint32_t Get_Timer_5ms() { return m_timers.timer_5ms; }


private:
  static void RestoreDeviceSett();
  static void Create_mem_pools();
  static void Task_device_sett(void * par);
  static void Create_dque();

  static __GLOBAL_TIMER_DEVICE  m_timers;
  static __SETTINGS_DEVICE      m_devSett;

};
//==============================================================================
//==============================================================================


#endif